﻿using System;
using System.Diagnostics;

namespace TfsMerge.BO
{
    [DebuggerDisplay("ID = {ID}, ChangesetId = {ChangesetId}")]
    public class HMergeItem : BaseBindObject
    {
        public HMergeItem(string branch, string parentBranch)
        {
            ID = branch;
            ParentID = parentBranch;
            IsPrimary = false;
        }

        public string ID { get; private set; }
        public string ParentID { get; private set; }
        public string Branch { get { return ID; } }
        public int? ChangesetId { get; private set; }
        public string Committer { get; private set; }
        public DateTime? CreationDate { get; private set; }
        public bool IsCommitted { get { return ChangesetId.HasValue; } }
        public bool IsPrimary { get; private set; }

        public void SetChangesetInfo(int changesetId, string committer, DateTime creationDate)
        {
            ChangesetId = changesetId;
            Committer = committer;
            CreationDate = creationDate;
        }

        public void SetChangesetId(int changesetId)
        {
            ChangesetId = changesetId;
        }

        public void SetPrimary()
        {
            IsPrimary = true;
        }
    }
}
